package tk.mystudio.web.util;

import tk.mystudio.idc.constant.BusinessItem;

/**
 * 位常量工具
 * @author <a href="mailto:jhezjkp@163.com">蒋昆朋</a>
 *
 */
public class BitConstantUtil {
	
	private BitConstantUtil() {
	}
	
	/**
	 * 某项是否选中
	 * @param value			数据值
	 * @param optionValue	需要校验的选项值
	 * @return
	 */
	public static boolean isChecked(int value, int optionValue) {
		return (value&optionValue)==optionValue;
	}
	
	public static void main(String[] args) {
		System.out.println(isChecked(BusinessItem.VIRTUAL_HOST+BusinessItem.EMAIL, BusinessItem.EMAIL));
		System.out.println(isChecked(BusinessItem.VIRTUAL_HOST+BusinessItem.EMAIL, BusinessItem.VIRTUAL_HOST));
		System.out.println(isChecked(BusinessItem.VIRTUAL_HOST+BusinessItem.EMAIL, BusinessItem.IP_RENT));
	}

}
